﻿/**
 * nPnP - neither Perl not PHP
 *
 * Copyright (C) 2009 Christian Moeller
 *
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by the 
 * Free Software Foundation; either version 3 of the License, or (at your option) 
 * any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; 
 * if not, see <http://www.gnu.org/licenses/>.
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FParser.Runtime
{
    public class BaseType
    {
        public BaseType()
        {
            this.objTypes = new Dictionary<string, BaseType>();
            this.bindMethods = new List<string>();
        }

        public BaseType(string name)
        {
            this.objTypes = new Dictionary<string, BaseType>();
            this.bindMethods = new List<string>();
            this.name = name;
        }

        private string name;
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }

        private string delegateMethod;
        public string DelegateMethod
        {
            get { return this.delegateMethod; }
            set { 
                this.delegateMethod = value;
                this.value = "";
                this.objTypes.Clear();
            }
        }

        private List<string> bindMethods;
        public List<string> BindMethods
        {
            get { return this.bindMethods; }
            set { this.bindMethods = value; }
        }

        private object value;
        public object Value
        {
            get { return this.value; }
            set { this.value = value; }
        }

        private Dictionary<string, BaseType> objTypes;
        public Dictionary<string, BaseType> ObjTypes
        {
            get { return this.objTypes; }
            set { this.objTypes = value; }
        }

        public static BaseType CreateAnonymous(object value)
        {
            return Executor.Executor.GetAnonymousType(value.ToString());
        }

        public static string RETURN_TRUE { get { return "1"; } }
        public static string RETURN_FALSE { get { return "0"; } }
        
    }
}
